'''
Created on 2011-4-20

@author: Administrator
'''
import wx
from programframe import ProgramFrame

class AppSplashScreen(wx.SplashScreen):
    def __init__(self):
        bmp = wx.Image("./pic/hint.png").ConvertToBitmap()
        wx.SplashScreen.__init__(self, bmp,
                                 wx.SPLASH_CENTRE_ON_SCREEN | wx.SPLASH_TIMEOUT,
                                 2000, None, -1)
        self.frame = ProgramFrame(None)
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        self.fc = wx.FutureCall(2000, self.ShowMain)

    def OnClose(self, evt):
        # Make sure the default handler runs too so this window gets
        # destroyed
        evt.Skip()
        self.Hide()

        # if the timer is still running then go ahead and show the
        # main frame now
        if self.fc.IsRunning():
            self.fc.Stop()
            self.ShowMain()

    def ShowMain(self):
        self.frame.CenterOnScreen()
        self.frame.Show()

        #self.frame.Maximize()
        if self.fc.IsRunning():
            self.Raise()
        
class MyApp(wx.App):
    def OnInit(self):
        wx.InitAllImageHandlers()
        splash = AppSplashScreen()
        splash.Show()
        return True
